#!/usr/bin/env ptyhon

import sys
if '__main__' == __name__:
    full = open('alexa.out', 'r')
    lost = open('titlegot', 'r')

    arr = [[],[]]
    while True:
        str = full.readline()
        if not str:
            break
        str = str.strip('\n')
        arr[0].append(str)
    while True:
        str = lost.readline()
        if not str:
            break
        str = str.strip('\n')
        arr[1].append(str)

    full.close()
    lost.close()
    lostones = open('lostones', 'r')

    while True:
        str = lostones.readline()
        if not str:
            break
        str = str.strip('\n')
        flag = True
        for i in range(len(arr[1])):
            if arr[1][i].find(str) >=0 :
                flag = False
                break
        if flag:
            cnt = 0
            for i in range(len(arr[0])):
                if arr[0][i].find(str) >= 0:
                    arr[1].insert(cnt, arr[0][cnt])
                cnt += 1

    for i in range(len(arr[1])):
        print arr[1][i]

    lostones.close()
